package com.health.system.controller;

import com.alibaba.nacos.api.model.v2.Result;
import com.health.common.core.utils.StringUtils;
import com.health.system.domain.po.TvideoPo;
import com.health.system.domain.vo.TvideoVo;
import com.health.system.service.TvideoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author xpz
 * @date 2024/12/16 19:51
 */
@RestController
@RequestMapping("/video")
public class TvideoController {


    @Autowired
    private TvideoService tvideoService;

    /**
     * 视频列表
     * @param tvideoVo
     * @return
     */
    @PostMapping("/videoList")
    public Result<List<TvideoPo>> videoList(@ModelAttribute TvideoVo tvideoVo){
        List<TvideoPo> list = tvideoService.videoList(tvideoVo);
        return Result.success(list);
    }

    /**
     * 视频添加
     */
    @PostMapping("/videoAdd")
    public Result videoAdd(@ModelAttribute TvideoPo tvideoPo){
          return   tvideoService.videoAdd(tvideoPo);
    }
    /**
     * 视频删除
     */
    @PostMapping("videoDel")
    public Result videoDel(@RequestParam("id") Integer id){
           tvideoService.removeById(id);
           return Result.success();

    }
    /**
     * 视频修改
     */
    @PostMapping("/videoUpdate")
    public Result videoUpdate(@ModelAttribute TvideoPo tvideoPo){
        return tvideoService.updateById(tvideoPo);

    }
}
